﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Parentmasterpage.master" CodeBehind="UploadVideoToCruises.aspx.vb" Inherits="WebApplicationcruises.UploadVideoToCruises" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style12
        {
            text-align: left;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="style11">
        <tr>
            <td style="border: thin solid #589BB6">
                <b>Add Cruises&gt;&gt; step 3 add video</b></td>
        </tr>
        <tr>
            <td style="border: thin solid #589BB6">
                <asp:FormView ID="FormView1" runat="server" DataKeyNames="VId" 
                    DataSourceID="SqlDataSourceVideo" DefaultMode="Insert">
                    <EditItemTemplate>
                        VId:
                        <asp:Label ID="VIdLabel1" runat="server" Text='<%# Eval("VId") %>' />
                        <br />
                        VPath:
                        <asp:TextBox ID="VPathTextBox" runat="server" Text='<%# Bind("VPath") %>' />
                        <br />
                        CrusisesId:
                        <asp:TextBox ID="CrusisesIdTextBox" runat="server" 
                            Text='<%# Bind("CrusisesId") %>' />
                        <br />
                        <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                            CommandName="Update" Text="Update" />
                        &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                            CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <table class="style11">
                            <tr>
                                <td>
                                    Video path</td>
                                <td class="style12">
                                    <asp:FileUpload ID="FileUpload1" runat="server" />
                                </td>
                                <td>
                                    <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                                        CommandName="Insert" Text="Add" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;</td>
                                <td class="style12">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                        </table>
                    </InsertItemTemplate>
                    <ItemTemplate>
                        VId:
                        <asp:Label ID="VIdLabel" runat="server" Text='<%# Eval("VId") %>' />
                        <br />
                        VPath:
                        <asp:Label ID="VPathLabel" runat="server" Text='<%# Bind("VPath") %>' />
                        <br />
                        CrusisesId:
                        <asp:Label ID="CrusisesIdLabel" runat="server" 
                            Text='<%# Bind("CrusisesId") %>' />
                        <br />

                    </ItemTemplate>
                </asp:FormView>
                <asp:SqlDataSource ID="SqlDataSourceVideo" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnectionStringDB %>" 
                    DeleteCommand="DELETE FROM [Videos] WHERE [VId] = ?" 
                    InsertCommand="INSERT INTO [Videos] ( [VPath], [CrusisesId]) VALUES (?, ?)" 
                    ProviderName="<%$ ConnectionStrings:ConnectionStringDB.ProviderName %>" 
                    SelectCommand="SELECT [VId], [VPath], [CrusisesId] FROM [Videos] WHERE ([CrusisesId] = ?)" 
                    
                    UpdateCommand="UPDATE [Videos] SET [VPath] = ?, [CrusisesId] = ? WHERE [VId] = ?">
                    <DeleteParameters>
                        <asp:Parameter Name="VId" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:SessionParameter Name="VPath" SessionField="fileupload" Type="String" />
                        <asp:SessionParameter Name="CrusisesId" SessionField="cid" Type="Int32" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:SessionParameter Name="CrusisesId" SessionField="Cid" Type="Int32" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="VPath" Type="String" />
                        <asp:Parameter Name="CrusisesId" Type="Int32" />
                        <asp:Parameter Name="VId" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>


            </td>
        </tr>
        <tr>
            <td style="border: thin solid #589BB6">
                <asp:GridView ID="GridViewVideo" runat="server" AutoGenerateColumns="False" 
                    DataKeyNames="VId" DataSourceID="SqlDataSourceVideo" Width="699px">
                    <Columns>
                        <asp:HyperLinkField DataNavigateUrlFields="Vpath" 
                            DataNavigateUrlFormatString="ViewVideo.aspx?id={0}" Text="ViewVideo" 
                            DataTextField="Vpath" HeaderText="List of the Videoes" />
                    </Columns>
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
        </tr>
    </table>
</asp:Content>
